﻿Public Class dsQuocGia
    'Khoi tao chi co Ma va Ten
    Private _maQT As Integer
    Private _tenQT As String

    Sub New()
        _maQT = 0
        _tenQT = ""
    End Sub

    Public Property MaQT As Integer
        Get
            Return _maQT
        End Get
        Set(value As Integer)
            _maQT = value
        End Set
    End Property
    Public Property TenQT As String
        Get
            Return _tenQT
        End Get
        Set(value As String)
            _tenQT = value
        End Set
    End Property
    'ham thuc hien
    Dim ctx As New QLDBDataContext
    'ko ALL
    Public Function LayQuocTich() As List(Of dsQuocGia)
        Dim query = From p In ctx.QUOCTICHes
                    Select New dsQuocGia With
                           {.MaQT = p.MaQT, .TenQT = p.TenQT}
        Return query.ToList()
    End Function
    'co ALL
    Public Function LayQuocTichTK() As IList
        Dim list As List(Of QUOCTICH)
        list = ctx.QUOCTICHes.ToList()
        list.Insert(0, New QUOCTICH With {.MaQT = -1, .TenQT = "ALL"})
        Return list

    End Function

End Class
